package com.tensquare.recruit.controller;

import com.tensquare.recruit.pojo.Enterprise;
import com.tensquare.recruit.service.EnterpriseService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("enterprise")
public class EnterpriseController {
    @Autowired
    private EnterpriseService enterpriseService;

    /**
     * 1.查询热点企业信息
     * @return  返回企业信息和状态
     */
    @GetMapping("search/hotlist")
    public Result hotlist(){
        try {
            List<Enterprise> enterpriseList = enterpriseService.hotlist();
            return new Result(StatusCode.OK,true,"查询热点企业成功！",enterpriseList);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(StatusCode.ERROR,false,"查询热点企业失败！");
        }
    }
}
